<%@ page language="java" contentType="text/html; charset=EUC-KR"
	pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Log-In</title>
<script>
	function authenticate() {
		$.ajax({
			type : "POST",
			url : "./index.jsp",
			data : "login_id=" + document.getElementById("login_id").value
					+ "&login_pw=" + document.getElementById("login_pw").value,
			dataType : "text",
			success : function(resp) {
				if (resp == "true") {
					$.fancybox.close();
				} else {
					alert("Enter the correct id and password");
				}
			}
		});
	}
	
	function confirm() {
		if(resp == "true") {
					alert("Success to register");
					location.href="index.jsp";
				}
				else {
					alert("false");
				}
		}
				
	function register() {
		$.fancybox({
			href : "UserRegister.jsp",
			onClosed : function() {
				parent.location.reload(true);
			}
		});

	}
</script>
</head>
<body>

	<table>
		<tr>
			<td>Id</td>
			<td><input id="id" type="text" /></td>
			<td width="75"><span id="validate_id"></span></td>
		</tr>
		<tr>
			<td>Password</td>
			<td><input id="password" type="password" /></td>
			<td width="75"><span id="validate_password"></span></td>
		</tr>
		<tr>
			<td colspan="2"><input type="submit" value="Log-In"
				onclick="authenticate()" /></td>
			<form action="UserRegister.jsp">
				<td colspan="2"><input type="submit" value="register"
					onclick="register()" /></td>
			</form>
		</tr>
	</table>

</body>
</html>